/**
 * @author Cheng Liu
 **/

#pragma once

#include "../Helper/HelperMarcos.h"

#include "Events.h"
#include "IEventHandler.h"
#include <map>
#include <set>

class EventBus {
	DECLARE_SINGLETON(EventBus);

public:
	void AttachListener(const Events::EventType& type, IEventHandler* handler);
    bool DettachListener(const Events::EventType& type, IEventHandler* handler);
    void ReleaseListener(const IEventHandler* handler);

    void PublishEvent(Events::Event * event);

private:

    std::map<Events::EventType, std::set<IEventHandler*> > listeners;
};
